import { handleActions } from 'redux-actions'
import util from '../util'

const init = {
  list: {},
  config: null,
  activity: null,
};

export default handleActions({
  'fetch survey activity': (state, { payload }) => ({
    ...state,
    activity: payload,
  }),
  'fetch survey': (state, { payload }) => ({
    ...state,
    list: payload,
  }),

  'fetch survey config': (state, { payload }) => ({
    ...state,
    config: payload,
  }),

  'reset survey': (state) => ({
    ...state,
    ...init,
  }),
}, init);
